package com.hzmg.support.util;

import com.hzmg.filter.GatewayFilter;
import com.hzmg.filter.factory.GatewayFilterFactory;

/**
 * 命名工具类
 *
 * @author Yukoo
 */
public class NameUtils {
    private NameUtils() {
        throw new AssertionError("Must not instantiate utility class.");
    }

    public static final String GENERATED_NAME_PREFIX = "_agkey_";

    public static final String ROUTE_CONFIGURATION_PREFIX = "akka.actor.deployment";

    private static final String AKKA_ACTOR_SYSTEM_SUFFIX = "System";

    public static String generateName(int i) {
        return GENERATED_NAME_PREFIX + i;
    }

    public static String normalizeActorRefSimpleName(Class<?> clazz) {
        return clazz.getSimpleName();
    }

    public static String normalizeActorSystemName(Class<?> clazz) {
        return clazz.getSimpleName() + AKKA_ACTOR_SYSTEM_SUFFIX;
    }

    public static String normalizeFilterName(Class<? extends GatewayFilterFactory> clazz) {
        return clazz.getSimpleName().replace(GatewayFilterFactory.class.getSimpleName(), "");
    }
}
